/** 
系统用户管理
 **/
package com.centon.auto_code.system.controller;

import com.centon.auto_code.system.service.SysUserService;
import com.centon.auto_code.system.vo.SysUserVo;
import com.centon.auto_code.system.vo.gen.SuperSysUserVo.SysUserController_addEntityInfo;
import com.centon.auto_code.system.vo.gen.SuperSysUserVo.SysUserController_deleteEntity;
import com.centon.auto_code.system.vo.gen.SuperSysUserVo.SysUserController_modifyEntityInfo;
import com.centon.auto_code.vo.BaseRes;
import com.centon.auto_code.vo.PageData;
import javax.annotation.Resource;
import javax.annotation.Title;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("adapi/sysUser")
public class SysUserController {

    @Resource
    private SysUserService sysUserService;

    /**
     * @gen_335_lwl
     * 用户列表
     * 用户列表
     * @param sysUserVo
    **/
    @Title("用户列表")
    @ResponseBody
    @RequestMapping(value="entityPage", method=RequestMethod.GET)
    public BaseRes<PageData<SysUserVo>> entityPage(SysUserVo sysUserVo) {
        return sysUserService.entityPage(sysUserVo);
    }

    /**
     * @gen_336_lwl
     * 用户详情
     * null
     * @param id
    **/
    @Title("用户详情")
    @ResponseBody
    @RequestMapping(value="entityInfo/{id}", method=RequestMethod.GET)
    public BaseRes<SysUserVo> entityInfo(@PathVariable("id") String id) {
        return sysUserService.entityInfo(id);
    }

    /**
     * @gen_337_lwl
     * 删除用户
     * null
     * @param sysUserVo
    **/
    @Title("删除用户")
    @ResponseBody
    @RequestMapping(value="entityInfo", method=RequestMethod.DELETE)
    public BaseRes<String> deleteEntity(@RequestBody @Validated(SysUserController_deleteEntity.class) SysUserVo sysUserVo, BindingResult bindingResult) {
        return sysUserService.deleteEntity(sysUserVo.getId());
    }

    /**
     * @gen_338_lwl
     * 添加用户
     * null
     * @param sysUserVo
    **/
    @Title("添加用户")
    @ResponseBody
    @RequestMapping(value="entityInfo", method=RequestMethod.POST)
    public BaseRes<String> addEntityInfo(@RequestBody @Validated(SysUserController_addEntityInfo.class) SysUserVo sysUserVo, BindingResult bindingResult) {
        return sysUserService.addEntityInfo(sysUserVo);
    }

    /**
     * @gen_339_lwl
     * 修改用户
     * null
     * @param sysUserVo
    **/
    @Title("修改用户")
    @ResponseBody
    @RequestMapping(value="entityInfo", method=RequestMethod.PUT)
    public BaseRes<String> modifyEntityInfo(@RequestBody @Validated(SysUserController_modifyEntityInfo.class) SysUserVo sysUserVo, BindingResult bindingResult) {
        return sysUserService.modifyEntityInfo(sysUserVo);
    }
}